import Vue from "vue";
import Vuex from "vuex";
import { _post } from "@/api";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    bedListData: []
  },
  getters: {
    bedListData: state => state.bedListData
  },
  mutations: {
    getBedListData(state, listData) {
      return (state.bedListData = listData);
    }
  },
  actions: {
    getBedListData({ commit }) {
      _post({ url: "index/index" }).then(res => {
        let data = res.data.lists.data;
        commit("getBedListData", data);
      });
    }
  }
});
